<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户分润平台管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
			$("#platformUserCode").focus();
			$("#inputForm").validate({
				rules: {
					userCode: {remote: "${ctx}/pay/platform/checkUserCode?oldLoginName=" + encodeURIComponent('${user.loginName}')}
				},
				messages: {
					platform: {remote: "该平台已存在"},
					userCode: {remote: "该平台用户代码已存在"},
					confirmNewPassword: {equalTo: "输入与上面相同的密码"}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/user/list">用户列表</a></li>
		<li><a href="${ctx}/pay/platform/list?uid=${user.id}">用户分润平台列表</a></li>
		<li class="active"><a href="${ctx}/pay/platform/form?id=${userPlatform.id}">用户分润平台${not empty userPlatform.id?'修改':'添加'}</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="userPlatform" action="${ctx}/pay/platform/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">姓名:</label>
			<div class="controls">
				<%-- <form:input path="name" htmlEscape="false" maxlength="50" readonly="true" class="required"/> --%>
				<input type="text" id="name" class="input-large" readonly="true" value="${user.name}"/>
				<form:hidden path="userId" value="${user.id}"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">登录名:</label>
			<div class="controls">
				<input type="text" id="loginName" class="input-large" readonly="true" value="${user.loginName}"/>
				<form:hidden path="userName" value="${user.loginName}"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">平台类型:</label>
			<div class="controls">
				<form:select path="platformId" class="required input-large">
					<form:option value="" label="请选择"/>
					<form:options items="${fns:getDictList('profit_platform')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">平台会员代码:</label>
			<div class="controls">
				<form:input path="platformUserCode" htmlEscape="false" maxlength="50" class="required input-large"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注:</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge"/>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>